indentation, commenta and other cleanups
authorØyvind Kolås <ok@src.gnome.org>
Tue, 23 Aug 2005 13:29:48 +0000 (13:29 +0000)
committerØyvind Kolås <ok@src.gnome.org>
Tue, 23 Aug 2005 13:29:48 +0000 (13:29 +0000)
ChangeLog
babl/babl-classes.c
babl/babl-classes.h
babl/babl-conversion.c
babl/babl-fish.h
babl/babl-image.c
babl/babl-image.h
babl/babl-instance.h
babl/babl-internal.c

index 18652addccf2965c6fa3d1adccf21fe119724ebc..8e37f08c37e21fab075d799077f93942098b01a5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-08-23  Øyvind Kolås  <pippin@gimp.org>
+
+       * babl/babl-classes.c,
+       * babl/babl-classes.h,
+       * babl/babl-conversion.c,
+       * babl/babl-fish.h,
+       * babl/babl-image.c,
+       * babl/babl-image.h,
+       * babl/babl-instance.h: Indentation, comments and other cleanup.
+
 2005-08-23  Øyvind Kolås  <pippin@gimp.org>
 
        * docs/index-static.html.in: update webdocs.
index 5b278bf46c935e4217fa25b24566eebe654a9983..8f2376d3e6f488b51eaf3560dd276d0bf88af8b7 100644 (file)
@@ -47,5 +47,9 @@ babl_class_name (BablClassType klass)
   return class_names[klass-BABL_INSTANCE];
 }
 
+/* global variable, indicating whether name lookups
+ * are frowned upon or not (they are frowned upon within BablBase,
+ * since that leads to more strings than neccesary in the library.)
+ */
 int babl_hmpf_on_name_lookups = 0;
 
index 727be57856779688d081329d25efc23941a4c1e7..8bd024d800e6790032c408ab64a4ff0b6502f53d 100644 (file)
@@ -160,22 +160,22 @@ typedef struct
 
 typedef struct
 {
-  BablInstance instance;
+  BablInstance     instance;
   BablConversion **from; /*< NULL terminated list of conversions from class */
   BablConversion **to;   /*< NULL terminated list of conversions to class   */
-  int          horizontal;
-  int          vertical;
-  char         name[4];
+  int              horizontal;
+  int              vertical;
+  char             name[4];
 } BablSampling;
 
 typedef struct
 {
-  BablInstance instance;
+  BablInstance     instance;
   BablConversion **from; /*< NULL terminated list of conversions from class */
   BablConversion **to;   /*< NULL terminated list of conversions to class   */
-  int          luma;
-  int          chroma;
-  int          alpha;
+  int              luma;
+  int              chroma;
+  int              alpha;
 } BablComponent;
 
 
@@ -213,9 +213,9 @@ typedef struct
 
 typedef struct
 {
-  BablInstance     instance;
-  union Babl      *source;
-  union Babl      *destination;
+  BablInstance    instance;
+  union Babl     *source;
+  union Babl     *destination;
 } BablFish;
 
 
index 7b6f668ff96007b0e803a5ead75c5704605ca95a..0c5ccd511130368d517b66c5e03d96f2bbda0b58 100644 (file)
@@ -264,6 +264,7 @@ babl_conversion_process (BablConversion *conversion,
                          void           *destination,
                          long            n)
 {
+  /*TODO: build planar formats if needed when linear pointers are passed in */
   assert (BABL_IS_BABL (conversion));
 
   switch (BABL(conversion)->class_type)
index 087146a971af3519b2941e0932de3b6a29c73af7..ad5235fe9a7c29396f1fa0cc4000f76d33ab181a 100644 (file)
 
 BABL_DEFINE_CLASS_NO_NEW_NO_ID(babl_fish)
 
-Babl *
-babl_fish (Babl *source,
-           Babl *destination);
+/** create a new BablFish capable of translating between the pixel
+ *  formats given in source and destination. (use babl_pixel_format (string))
+ */
+Babl * babl_fish              (Babl *source,
+                               Babl *destination);
 
-/* babl_fish_process will probably be a polymorph function
- * accepting source and destination buffer pointers will be
- * allowed as well as BablImage objects in their place
+/* Transform n pixels from source into destination,
+ * source and destination can be pointers to linear buffers
+ * (or at a later stage of babl development BablImages)
  */
-int
-babl_fish_process        (Babl *babl_fish,
-                          void *source,
-                          void *destination,
-                          int   n);
+int    babl_fish_process      (Babl *babl_fish,
+                               void *source,
+                               void *destination,
+                               int   n);
 
 /* whether the BablFish needs a BablImage to do the processing,
- * or void * are sufficient.
+ * or a void pointer to a linear buffer is sufficient.
  */
-int
-babl_fish_needs_image (Babl *babl_fish);
+int    babl_fish_needs_image  (Babl *babl_fish);
 
 #endif
index da204157160d08620731643d2d571e1d1e5f8ce6..831925c9e748fb91c1e1cdc4249507ddacda516d 100644 (file)
 
 #define BABL_MAX_BANDS 32
 
-static BablImage *db[100]={NULL,};
-
-#if 0
-static int 
-each_babl_image_destroy (Babl *babl,
-                         void *data)
-{
-  babl_free (babl);
-
-  return 0;  /* continue iterating */
-}
-#endif
-
 static Babl *
 image_new (int             bands,
            BablComponent **component,
@@ -61,7 +48,6 @@ image_new (int             bands,
   babl->image.data          = ((void *)babl->image.component) + sizeof (BablComponent*) * (bands+1);
   babl->image.pitch         = ((void *)babl->image.data)      + sizeof (void*)          * (bands+1);
   babl->image.stride        = ((void *)babl->image.pitch)     + sizeof (int)            * (bands+1);
-/*babl->image.foo           = ((void *)babl->image.stride)    + sizeof (int)            * (bands+1);*/
 
   babl->class_type    = BABL_IMAGE;
   babl->instance.id   = 0;
@@ -212,33 +198,14 @@ babl_image_new (void *first,
   return babl;
 }
 
-void
-babl_image_each (BablEachFunction  each_fun,
-                 void             *user_data)
-{
-  int i;
-  return;
-
-  while (db[i])
-    {
-      if (each_fun ((Babl *) (db[i]), user_data))
-        {
-          return;
-        }
-      else
-        {
-          i++;
-        }
-    }
-}
-
-
 void
 babl_image_destroy (void)
 {
+  /* nothing to do */
 }
 
 void
 babl_image_init (void)
 {
+  /* nothing to do */
 }
index fc33e0e3773522f94a2c8bb96e0749c17790588a..611575034db6d03260b17c34ca35d0f57a92fed8 100644 (file)
 
 #include "babl-classes.h"
 
-void   babl_image_init       (void);
-void   babl_image_introspect (void);
-void   babl_image_each       (BablEachFunction  each_fun,
-                              void             *user_data);
-void   babl_image_destroy    (void);    
-Babl * babl_image_new        (void *first_component,
+/* babl images are allocated as a single chunk of memory, and
+ * thus can be duplicated using  duplicate = babl_dup (original);
+ *
+ * NB: babl_fish_process () frees the images passed in by itself.
+ */
+Babl * babl_image_new             (void *first_component,
                                    ...);
 
 /* create a new BablImage based on a packed BablPixelFormat (or BablModel which
  * is a virtual pixelformat based on the BablModel using only doubles in the
  * order they are listed in the model.
  */
-Babl *
-babl_image_new_from_linear (void *buffer,
-                            Babl *format);
+Babl * babl_image_new_from_linear (void *buffer,
+                                   Babl *format);
+
 #endif
index 17f246e103ba8ebfd9f61c3efbed4c7fa169649d..34ee02669a15d4f7e4999cf42c51a4bd3093aee3 100644 (file)
@@ -10,8 +10,8 @@ typedef int  (*BablEachFunction) (Babl *entry,
  * headers to a minimum, only the ones overriding the basic api with
  * custom ways of construction.
  */
-#define BABL_DEFINE_CLASS(type_name)                             \
-                                                                 \
+#define BABL_DEFINE_CLASS(type_name)                      \
+                                                          \
 void   type_name##_init    (void);                        \
 void   type_name##_destroy (void);                        \
 void   type_name##_each    (BablEachFunction  each_fun,   \
@@ -20,8 +20,8 @@ Babl * type_name           (const char       *name);      \
 Babl * type_name##_id      (int               id);        \
 Babl * type_name##_new     (const char       *name,       \
                             ...);
-#define BABL_DEFINE_CLASS_NO_NEW_NO_ID(type_name)                \
-                                                                 \
+#define BABL_DEFINE_CLASS_NO_NEW_NO_ID(type_name)         \
+                                                          \
 void   type_name##_init    (void);                        \
 void   type_name##_destroy (void);                        \
 void   type_name##_each    (BablEachFunction  each_fun,   \
index 5b278bf46c935e4217fa25b24566eebe654a9983..8f2376d3e6f488b51eaf3560dd276d0bf88af8b7 100644 (file)
@@ -47,5 +47,9 @@ babl_class_name (BablClassType klass)
   return class_names[klass-BABL_INSTANCE];
 }
 
+/* global variable, indicating whether name lookups
+ * are frowned upon or not (they are frowned upon within BablBase,
+ * since that leads to more strings than neccesary in the library.)
+ */
 int babl_hmpf_on_name_lookups = 0;